var a = [11, 12, 13];
window.onload = show;
function rightIn() {
    var b = parseInt(document.getElementById("getNumber").value);
    if(b<101&&b>11){
    	if(a.length<61){
    a.push(b);
    change();
	show();
      }
       else{
       	alert("数量超出限制");
       }
     }
     else{
     	alert("输入范围在10~100间");
     }
}
function leftIn() {
    var b = parseInt(document.getElementById("getNumber").value);
    if(b<101&&b>11){
    	if(a.length<61){    	
    a.unshift(b);
    change();
	show();
    } 
    else{
    	alert("数量超出限制");
    }
     }
     else{
     	alert("输入范围在10~100间");
     }
}
function leftOut() {
    var b = parseInt(document.getElementById("getNumber").value);
    a.shift(b);
    change();
	show();
}
function rightOut() {
    var b = parseInt(document.getElementById("getNumber").value);
    a.pop(b);
    change();
	show();
}
function show() {
	console.log("123");
	var n=a.length;
	for (var i = 0; i < a.length; i++) {
		console.log("123");
		var append = document.getElementById("box");
		var newNode = document.createElement("div");
		newNode.setAttribute("class", "number");
		newNode.innerHTML = a[i];
		newNode.style.height=a[i]*1+'px';
		append.appendChild(newNode);
		newNode.onclick = foo; 
	}	
}
function change(){
	var append = document.getElementById("box");
	    while(append.hasChildNodes()) //当div下还存在子节点时 循环继续
    {
        append.removeChild(append.firstChild);
    }
}
function foo(event){
	console.log(event);
	event.target.parentNode.removeChild(event.target);

}
function line(){
	a.sort();
	change();
	show();
}